def triangles():
    N=[1]
    while True:
        yield N
        s=N[:]
        s.append(0)
        #i从0开始取，s[0-1]就是在取额外添加在末尾的0相加，保证最左和最右两列始终是1
        N=[s[i-1]+s[i] for i in range(len(s))]